package pers.echo.tester.service.impl;


import org.springframework.beans.factory.annotation.Autowired;
import pers.echo.tester.entity.TblTkqinfo;
import pers.echo.tester.enums.ResTypeEnum;
import pers.echo.tester.mapper.TblTkqinfoMapper;
import pers.echo.tester.service.ITblTkqinfoService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;

/**
 * <p>
 * ?????? 服务实现类
 * </p>
 *
 * @author jobob
 * @since 2020-09-17
 */
@Service
public class TblTkqinfoServiceImpl extends ServiceImpl<TblTkqinfoMapper, TblTkqinfo> implements ITblTkqinfoService {

    @Autowired(required = false)
    TblTkqinfoMapper mapper;

    @Override
    public TblTkqinfo getTkqinfoTemplate() {
        TblTkqinfo tkqinfo = mapper.getFirstTkqinfo();
        if(tkqinfo!=null){
            tkqinfo.setBulletinid(null);
            tkqinfo.setTkqinfoid(null);
            tkqinfo.setFNo(null);

            LocalDateTime beginTime = LocalDateTime.now();
            LocalDateTime bailTime = beginTime.plusDays(10);
            LocalDateTime startTime = beginTime.plusDays(20);
            LocalDateTime closeTime = beginTime.plusDays(30);

            tkqinfo.setFBeigintime(startTime);
            tkqinfo.setFClosetime(closeTime);
            tkqinfo.setFFinishtime(closeTime);
            tkqinfo.setLastfixtime(beginTime);
            tkqinfo.setCreatedtime(beginTime);
            tkqinfo.setFBailtime(bailTime);

            tkqinfo.setFStatuscode("K");
            return tkqinfo;
        }
        return null;
    }
}
